<?php
class TValidation implements TValidation_Interface, TPlugin_Interface, TPlugin_Front_Interface, TPlugin_Self_Interface
{
	public $priority = TValidationConf::PRIORITY;
	protected $self;
	protected $req = array();

	public function pry(){
		if(isset($this->priority)){
			return $this->priority;
		}else{
			return self::PRIORITY;
		}
	}
	public function set(){
		$this->self = TInstances::getSelf();
	}
	public function req($i){
		$this->req = $i;
	}
	public function act(){
		if(TValidationConf::RUTING !== true) return;

		TValidationConf::init();

		$rute = @$req[TValidationConf::RUTE_REQUEST];
		return explode('/', $rute);
		if(isset($rute[0]) && strlen($rute[0]) > 0){
			$class = $rute[0];
		}else{
			return;
		}
		$class = ucfirst($class);
		$class = $class.TValidationConf_VALIDATER;

		if(isset($rute[1]) && strlen($rute[0]) > 0){
			$method = $rute[1];
		}else{
			$method = TValidationConf_DEFAULT_METHOD;
		}

		require_once(TValidationConf_DIR.DS.$class.'.php');

		if(!class_exists($class)) return;

		$controller = new $class;

		if(!($controller instanceof TValidationConf_Action_Interface)) return;
		if(!method_exists($controller, $method)) return;

		$controller->$method($rute);
	}
}
